﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ComputerArchitecture.Core
{
    public static class ArgumentValidator
    {
        public static void NullValidate<TArg>(TArg arg) where TArg : class
        {
            if (ReferenceEquals(arg, null))
            {
                throw new ArgumentNullException();
            }
        }

        public static void NullValidate(object arg)
        {
            NullValidate(arg, string.Empty);
        }

        public static void NullValidate(object arg, string argName)
        {
            if (ReferenceEquals(arg, null))
            {
                throw new ArgumentNullException(argName);
            }
        }
    }
}
